<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>详情页面</title>
</head>
<body>

<button onclick="safeExit()">安全退出</button>
<h1>详情页面</h1>

<h1 id="pageInfo"></h1>
<img id="photo"  width="100px" height="100px"><br/>

<a href="resetPassword.html">修改密码</a>

    <a id="update">修改信息</a>


    <a href="stuList.html" id="stuList">查看所有学生</a>




<script src="js/jquery-1.8.2.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">

  function safeExit(){
    window.location = "user?action=doLoginOut";
  }

  $.post(
          "user",
          {"action":"getUser"},
          function (data){

            let user = eval("(" + data + ")").user;
            let role = eval("(" + data + ")").role;

            let name = user.name;
            let photo = user.photo;


            if (role == "student"){
              $("#pageInfo").text("欢迎" + name + "学生进入到学生管理系统");
              $("#update").attr("href","stuInfo.html")
                $("#stuList").hide();
            }else if (role == "teacher"){

              $("#pageInfo").text("欢迎" + name + "老师进入到学生管理系统");
              $("#update").attr("href","teaInfo.html")
              $("#stuList").show();
            }
            $("#photo").attr("src",photo);
          }
  )
</script>

</body>
</html>